// hooks/useOrderActions.ts
import { useState } from 'react'
import type { orderType } from '@/types'

export default function useOrderActions() {
  const [currentOrder, setCurrentOrder] = useState<orderType>()
  const [isDetailOpen, setIsDetailOpen] = useState(false)
  const [dispatchVisible, setDispatchVisible] = useState(false)

  const editOrder = (row: orderType) => {
    setCurrentOrder(row)
    setIsDetailOpen(true)
  }

  const dispatchOrder = (row: orderType) => {
    setCurrentOrder(row)
    setDispatchVisible(true)
  }

  return {
    currentOrder,
    isDetailOpen,
    dispatchVisible,
    editOrder,
    dispatchOrder,
    setDispatchVisible
  }
}